package com.aop.example;

import com.aop.example.service.UserService;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class test {
    @Test
    public void test1(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext1.xml");
        //这里代理的是接口！！！
        UserService userService = (UserService) context.getBean("userService");
        userService.add();
    }

    @Test
    public void test2(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext2.xml");

        UserService userService = (UserService) context.getBean("userService");
        userService.add();
    }

    @Test
    public void test3(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext3.xml");

        UserService userService = (UserService) context.getBean("userService");
        userService.add();
    }

}
